<template>
  <!-- 左边 -->
  <div>
    <div class="DetailPage" v-for="(item,index) in posts" :key="index">
      <div class="crumbs col">
        <router-link to="/post"><span>旅游攻略</span></router-link>
        <i>/</i> 攻略详情
      </div>
      <h1>{{item.title}}</h1>
      <el-row type="flex" justify="end" class="post-info col">
        <span>攻略：{{item.city.created_at}}</span>
        <span>阅读：{{item.watch}}</span>
      </el-row>
      <div v-html="item.content" class="post-content">
      </div>
     
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      posts: {}
    };
  },
  mounted() {
    this.$axios({
      url: "/posts",
      params: {
        id: this.$route.query.id
      }
    }).then(res => {
      const { data } = res.data;
      this.posts = data;
      console.log(this.posts);
    });
  },
  methods: {}
};
</script>

<style scoped lang="less">
.DetailPage {
  margin: 0;
  padding: 0;
  .col {
    color: #999;
  }
  .crumbs {
    font-size: 14px;
    span {
      color: #303133;
      cursor: pointer;
      font-weight: 600;
      &:hover {
        color: skyblue;
      }
    }
    i {
      margin: 0 5px;
    }
  }
  h1 {
    font-size: 2em;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
  }
  .post-info {
    padding: 20px 0;
    font-size: 16px;
    span {
      margin-right: 20px;
    }
  }
  .post-content{
   /deep/ img{
     max-width: 700px!important;
    }
  }
}
</style>